package de.sup.scs.prototyp.client.ui.title;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.Button;
import com.google.inject.Inject;
import com.gwtplatform.mvp.client.HasUiHandlers;
import com.gwtplatform.mvp.client.Presenter;
import com.gwtplatform.mvp.client.View;
import com.gwtplatform.mvp.client.annotations.NameToken;
import com.gwtplatform.mvp.client.annotations.ProxyCodeSplit;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import com.gwtplatform.mvp.client.proxy.PlaceRequest;
import com.gwtplatform.mvp.client.proxy.ProxyPlace;
import com.gwtplatform.mvp.client.proxy.RevealContentEvent;
import de.sup.scs.prototyp.client.ui.main.MainPagePresenter;

public class TitlePresenter extends Presenter<TitlePresenter.MyView, TitlePresenter.MyProxy> implements TitleUiHandlers{


    @Override
    public void OnClick(int dachtyp) {

        switch (dachtyp){
            case 0: placeManager.revealPlace(new PlaceRequest("graphicPD")); break;
            case 1: placeManager.revealPlace(new PlaceRequest("graphicSD")); break;
            case 2: placeManager.revealPlace(new PlaceRequest("graphicWD")); break;
        }
    }

    public interface MyView extends View, HasUiHandlers<TitleUiHandlers> {}

    @ProxyCodeSplit
    @NameToken("title")
    public interface MyProxy extends ProxyPlace<TitlePresenter> {}

    private final PlaceManager placeManager;

    @Inject
    public TitlePresenter(EventBus eventBus, MyView view, MyProxy proxy, PlaceManager manager) {
        super(eventBus, view, proxy);
        getView().setUiHandlers(this);
        placeManager = manager;
    }

    @Override
    protected void revealInParent() {
        RevealContentEvent.fire(this, MainPagePresenter.TITLE, this);
    }

}
